package com.yanggu.scala.chapater18.viewbounds

object ViewBoundsDemo03 {

  def main(args: Array[String]): Unit = {
    //导入自定义的隐式转换
    import MyImplicit.person2OrderedPerson
    val person1 = new Person22("张三", 20)
    val person2 = new Person22("李四", 23)
    val value = new CompareComm3[Person22](person1, person2)
    println(value.geater)
  }

}

class Person22(val name: String, val age: Int)  {

  override def toString = this.name + "\t" + this.age

}

class CompareComm3[T <% Ordered[T]](obj1: T, obj2: T) {

  def geater = if (obj1 > obj2) obj1 else obj2

}

